package com.tledu.production.service.device.impl;


import com.tledu.production.mapper.device.DeviceMapper;
import com.tledu.production.model.device.Device;
import com.tledu.production.service.device.DeviceService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

@AllArgsConstructor
@Service
public class DeviceServiceImpl implements DeviceService {

    private final DeviceMapper deviceMapper;
    //分页
    @Override
    public List<Device> list() {
        return deviceMapper.list();
    }

    //添加
    @Override
    public int insert(Device device) {
        return deviceMapper.insert(device);
    }

    //删除
    @Override
    public int delete(String deviceId){
        return deviceMapper.delete(deviceId);
    }

    //更新
    @Override
    public int update(Device device) {
        return deviceMapper.update(device);
    }

    //根据不同字段搜索
    @Override
    public List<Device> search(String type, String searchText) {
        return deviceMapper.search(type, searchText);
    }


    //根据id查询
    @Override
    public Device findById(String deviceId) {
        return deviceMapper.findById(deviceId);
    }

    //富文本
    @Override
    public String findEdit(String deviceId) {

        return deviceMapper.findEdit(deviceId);
    }

    //富文本保存
    @Override
    public int save(String deviceId) {
        return deviceMapper.save(deviceId);
    }
}
